import Koa from "koa";
import cors from "koa2-cors";
import logger from "./middlewares/logger.js";
import compress from "./middlewares/compress.js";
import bodyParser from "./middlewares/bodyParser.js";
import staticPath from "./middlewares/static.js";
import router from "./routes/index.js";

const app = new Koa();

app.use(cors({ origin: '*', credentials: true }));
app.use(compress());
app.use(logger());
app.use(bodyParser());
app.use(staticPath());
app.use(router.routes()).use(router.allowedMethods());

export default app;
